import {queryList,queryAreaList, queryRootProvinceList} from "@/api/certificate/area";

export let AreaMixins = {
  data() {
    return {
      //省市区街道
      mixinsProvinceList:[],
      mixinsCityList:[],
      mixinsAreaList:[],
      mixinsStreetList:[]
    };
  },
  created() {
    this.initProvinceList();
  },
  methods: {
    changeList(code,listName){
      queryList(code).then(response => {
        this[listName] = response.rows
      })
    },
    mixinsAreaChange(code,listName){
      queryAreaList(code).then(response => {
        this[listName] = response.rows
      })
    },
    mixinsCityChange(code){
      queryAreaList(code).then(response => {
        this.mixinsAreaList = response.rows
      })
    },
    mixinsProvinceChange(code){
      queryAreaList(code).then(response => {
        this.mixinsCityList = response.rows
      })
    },
    initProvinceList() {
      queryRootProvinceList().then(response => {
        this.mixinsProvinceList = response.rows
      })
    },
  }
}
